<?php
  function notification_form_validation($form) {

    chkbadchar($form['field_not_description'][0]['value']['#value'],$form['field_not_description']['#title'],'field_not_description');
    chkbadchar($form['title']['#value'], $form['title']['#title'], 'title');
    chkbadchar($form['field_not_keyword']['und'][0]['value'] ['#value'],$form['field_not_keyword']['und'][0]['value']['#title'],'field_not_keyword');
	chkbadchar($form['field_not_short_title'][0]['value']['#value'],$form['field_not_short_title']['#title'],'field_not_short_title');

	// district validation
	distvalidation($form['field_not_district']['und']['#value']);

	// Date Validation

	Commencement_date($form['field_not_date']['und'][0]['value']['date']['#value'],$form['field_not_date']['und'][0]['#title'],'field_not_date');
	//check_date_expire($form['field_not_date'][0]['value']['date']['#value'],$form['field_not_date']['#title']);

	// maximum length validation for Title and Description Field
  	maxlength_validation($form['title']['#value'], 255, $form['title']['#title'], 'title');

	// minimum length charcter
  	minilength_validation($form['title']['#value'], 5, $form['title']['#title'], 'title');
  	minilength_validation($form['field_not_keyword']['und'][0]['value'] ['#value'], 5, $form['field_not_keyword']['und'][0]['value']['#title'],'field_not_keyword');
	minilength_validation($form['field_not_description'][0]['value']['#value'], 5, $form['field_not_description']['#title'],'field_not_description');

    // Circulars Number
	check_integer($form['field_not_number']['und'][0]['value']['#value'],$form['field_not_number']['und'][0]['value']['#title'],'field_not_number');
	check_integer($form['field_act_year'][0]['value']['#value'], $form['field_act_year']['#title'], $form['field_act_year'][0]['#field_name']);

	// Circulars Year
	check_integer($form['field_not_year'][0]['value']['#value'],$form['field_not_year']['#title'],'field_not_year');
	years($form['field_not_year'][0]['value']['#value'],$form['field_not_year']['#title'],'field_not_year');

	if ($form['field_not_availabilty']['und']['#value'] == 'online') {
	  url_validation($form['field_not_url']['und'][0]['value']['#value']);
	}


  if ($form['field_not_availabilty']['und']['#value'] == 'download') {
	$filename = $form['field_not_upload']['und'][0]['#file'];
	$filename->filename;
    file_upload_validation_D7($filename->filename,$form['field_not_availabilty']['und']['#title']);

  }

  }
  function notification_presave_validation($node) {
    $reference_url = $node->field_docurl[0]['value'];
    $node->field_docurl[0]['value'] = url_validation($reference_url);
  }




